package com.ihr360.commons.model.type;

public enum ResourcePublicity {

    /**
     * 公司
     */
    COMPANY("公司内公开"),

    /**
     * 个人私有
     */
    PERSONAL("个人私有");

    ResourcePublicity(String title) {
        this.title = title;
    }

    private String title;

    public String getTitle() {
        return title;
    }

    public final static class Publicity {
        public final static int NONE = 0;
        public final static int COMPANY = 8;
        public final static int PERSONAL = 16;
    }

    public static ResourcePublicity getResourcePublicity(Integer publicity) {
        if (publicity == null) {
            return ResourcePublicity.PERSONAL;
        }
        if (publicity == Publicity.COMPANY) {
            return ResourcePublicity.COMPANY;
        }
        if (publicity == Publicity.PERSONAL) {
            return ResourcePublicity.PERSONAL;
        }
        return ResourcePublicity.PERSONAL;
    }

    public static int getPublicity(ResourcePublicity resourcePublicity) {
        if (resourcePublicity == ResourcePublicity.COMPANY) {
            return Publicity.COMPANY;
        }
        if (resourcePublicity == ResourcePublicity.PERSONAL) {
            return Publicity.PERSONAL;
        }
        return Publicity.NONE;
    }

}